 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Storage
{
    public class Present
    {
        private List<Object> Tasties = new List<Object>();
        public int count_total_weight()
        {
            int total = 0;
            for (int i = 0; i < Tasties.Count(); ++i)
            {
                if (Tasties.ElementAt(i) is Chocolate_sweets)
                {
                    Chocolate_sweets obj = (Chocolate_sweets)Tasties.ElementAt(i);
                    total += obj.get_weight();
                }
                else if (Tasties.ElementAt(i) is Jujube)
                {
                    Jujube obj = (Jujube)Tasties.ElementAt(i);
                    total += obj.get_weight();
                }
                else if (Tasties.ElementAt(i) is Caramel)
                {
                    Caramel obj = (Caramel)Tasties.ElementAt(i);
                    total += obj.get_weight();
                }
                else if (Tasties.ElementAt(i) is White)
                {
                    White obj = (White)Tasties.ElementAt(i);
                    total += obj.get_weight();
                }
                else if (Tasties.ElementAt(i) is Dark)
                {
                    Dark obj = (Dark)Tasties.ElementAt(i);
                    total += obj.get_weight();
                }
                else if (Tasties.ElementAt(i) is Waffle)
                {
                    Waffle obj = (Waffle)Tasties.ElementAt(i);
                    total += obj.get_weight();
                }
                else if (Tasties.ElementAt(i) is Cookie)
                {
                    Cookie obj = (Cookie)Tasties.ElementAt(i);
                    total += obj.get_weight();
                }
            }
            return total;
        }
        public void add_snack(Object Tasty){
            Tasties.Add(Tasty);
        }
        public List<Object> get_snacks()
        {
            return Tasties;
        }
    }
    public class Tasty
    {
        public int weight;
        public void set_weight(int p)
        {
            weight = p;
        }
        public int get_weight()
        {
            return weight;
        }
    }
    public class Sweets : Tasty
    {
        public int number;
        public string uncover(int n)
        {
            number = n;
            string st = "Number of sweets: "+n.ToString()+".";
            return st;
        }
    }

    public class Chocolate : Tasty
    {
        public int length;
        public int width;
        public string unpack(int l, int w)
        {
            length = l;
            width = w;
            string st = "Size of chocolate: " + l.ToString()+":"+w.ToString()+".";
            return st;
        }
    }

    public class Patiserie : Tasty
    {
        public double price;
        public string try_p(int p, double eaten)
        {
            price=p*3.14*(1-eaten*0.01);
            string st = "Price of patiserie:  " + price.ToString();
            return st;
        }
    }

    public class Chocolate_sweets : Sweets
    {
        public int chocolate_content;
        public string put_into_tea(int c)
        {
            chocolate_content = c;
            string res = "Sweets contain " + c.ToString() + "% of chocolate .";
            return res;
        }
    }

    public class Jujube : Sweets
    {
        public int gelatine;
        public string bite_off(int g, double percent)
        {
            gelatine = g;
            string res = "Sweets contain " + g.ToString() + "% of chocolate and " + percent.ToString() + "% of sugar.";
            return res;
        }
    }

    public class NewSweets : Sweets
    {
        public int atr;
        public string bite_off(int g, double percent)
        {
            gelatine = g;
            string res = "Sweets contain " + g.ToString() + "% of chocolate and " + percent.ToString() + "% of sugar.";
            return res;
        }
    }
    
    public class Caramel : Sweets
    {
        public int sugar;
        public string eat(int s, bool like)
        {
            sugar = s;
            string st = "It contains " + s.ToString() + " of sugar.";
            if (like)
                st += " You will like it.";
            else
                st += " You won't like it.";
            return st;
        }
    }

    public class White : Chocolate
    {
        public int milk;
        public string wonder(int m)
        {
            milk = m;
            string res = "Chocolate contains " + m.ToString() + "% of milk.";
            return res;
        }
    }

    public class Dark : Chocolate
    {
        public int cocoa;
        public string soil_clothes(int c, double area)
        {
            cocoa = c;
            area = c * 3.14 * area * area;
            string res = "The area is " + area.ToString() + ".";
            return res;
        }
    }

    public class Waffle : Patiserie
    {
        public int number;
        public string snap(int n)
        {
            number = n;
            string res = "You snapped " + n.ToString() + " waffles.";
            return res;
        }
    }

    public class Cookie : Patiserie
    {
        public int fragility;
        public string rejoice(int f, double broke)
        {
            fragility = f;
            broke = f * f * broke - 2.71 * f;
            string res = "Your broke coefficient is" + broke.ToString() + ".";
            return res;
        }
    }

    public interface ILogger
    {
        void Log(string mes);
    }
}
